#ifndef _BSART_H_
#define _BSART_H_

#include "stm32f4xx.h"
	
#ifdef __cplusplus
 extern "C" {
#endif
	 
#define BYTE0(dwTemp)       (*(char *)(&dwTemp))
#define BYTE1(dwTemp)       (*((char *)(&dwTemp) + 1))
#define BYTE2(dwTemp)       (*((char *)(&dwTemp) + 2))
#define BYTE3(dwTemp)       (*((char *)(&dwTemp) + 3))

typedef struct {
	u8 SendPID1_Flag;
	u8 SendPID2_Flag;
	u8 SendPID3_Flag;
	u8 SendCheck_Flag;
	u8 SendPitchMid_Flag;
	u8 SendPitchMin_Flag;
	u8 SendPitchMax_Flag;
	u8 SendYaw_Flag;
	u8 SendRFREV_Flag;
	u8 PrintfFlag;
	u8 Loop_10ms;
	u8 Loop_20ms;
	u8 Loop_50ms;
	u8 Loop_75ms;
	u8 Loop_100ms;
	u8 Loop_200ms;
}_Flag_t;

extern _Flag_t data_f;
extern float &PIDPara0, &PIDPara1, &PIDPara2,\
					&PIDPara3, &PIDPara4, &PIDPara5,\
					&PIDPara6, &PIDPara7, &PIDPara8,\
					&PIDPara9, &PIDPara10, &PIDPara11,\
					&PIDPara12, &PIDPara13, &PIDPara14,\
					
					&PitchMidPara,&PitchMinPara, &PitchMaxPara, &YawPara, \

					&SliderPara0,&SliderPara1, &SliderPara2, &SliderPara3, \

					&FormPara0,&FormPara1, &FormPara2, &FormPara3, &FormPara4,\
					&FormPara5,&FormPara6, &FormPara7, &FormPara8, &FormPara9;

extern s16	&RFPara, &SpeedPara0, &SpeedPara1,\
					&SpeedPara2, &SpeedPara3, &SpeedPara4;

 void Time_Slice(void);
void Data_Receive_Anl(u8 *data_buf,u8 num);
void SendCheck(void);
void SendPIDGroup1(void);
void SendPIDGroup2(void);
void SendPIDGroup3(void);
void SendFormDataGroup1(void);
void SendFormDataGroup2(void);
void SendSliderData(void);
void SendRFREVData(void);
	 
#ifdef __cplusplus
 }
#endif
 
 void RL_SendSingleData(u8 start, float data);
 void RL_SendSingleData(u8 start, float data0, float data1, float data2);
 void RL_SendSingleData(u8 start,float data0, float data1, float data2,float data3);
 void RL_SendSingleData(u8 start, float data0, float data1, float data2, float data3, float data4 );
 void RL_SendSingleData(u8 start, float data0, float data1, float data2, float data3, float data4 ,float data5);
 void RL_SendInt16Data(u8 start, int16_t data0, int16_t data1, int16_t data2, int16_t data3, int16_t data4 , int16_t data5 );
 
 #endif
 
 